package com.ti.winona.ui;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.ti.winona.App;
import com.ti.winona.ui.fragment.MenuLeftFragment;

import android.os.Bundle;
import android.view.View;

public class MainActivity extends BaseSlidingFragmentActivity {
	
	private View mRelHomConversation;
	private View mLinHomeAcademic;
	private View mLinHomePertool;
	private View mLinHomePersonalset;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		initSlidingMenu();	// 设置SlidingMenu
		addLeftMenuFragment();	// 添加leftMenu
		
		setContentView(R.layout.activity_main);
		findView();
		initListner();
	}
	
	private void initSlidingMenu() {
		getSlidingMenu().setMode(SlidingMenu.LEFT);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	}
	
	private void addLeftMenuFragment() {
		getSupportFragmentManager().beginTransaction()
					.replace(R.id.menu_frame, new MenuLeftFragment()).commit();
	}
	
	private void findView() {
		mRelHomConversation = (View) findViewById(R.id.rel_home_conversation);
		mLinHomeAcademic = (View) findViewById(R.id.lin_home_academic);
		mLinHomePertool = (View) findViewById(R.id.lin_home_pertool);
		mLinHomePersonalset = (View) findViewById(R.id.lin_home_personalset);
	}
	
	private void initListner() {
		// 我的会话
		mRelHomConversation.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				App.showToast("我的会话");
			}
		});
		// 学术中心
		mLinHomeAcademic.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				App.showToast("学术中心");
			}
		});
		// 个人工具
		mLinHomePertool.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				App.showToast("个人工具");
			}
		});
		// 个人设置
		mLinHomePersonalset.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				App.showToast("个人设置");
			}
		});

	}
	
	
    
}
